<template>
    <div>
        <!-- 获取vuex的state的数据 -->
        {{this.$store.state.count}}
        <br/>
        <!-- 获取vuex的getters数据 -->
        {{this.$store.getters.newCount}}
        <br/>
        <button @click="add()">调用vuex的方法</button>
        <br/>
        <button @click="useAction()">使用action</button>
    </div>
</template>
<script>
import store from '../Vuex/store'
export default {
    name:'Vuex',
    store:store,
    methods: {
        add(){
            console.log('1');
            this.$store.commit('add',1);
        },
        useAction(){
            this.$store.dispatch('addAction',1);
        }
    },
}
</script>
<style scoped>

</style>